# Contributor: fossdd <fossdd@pwned.life>
# Maintainer: fossdd <fossdd@pwned.life>
pkgname=ntfy-alertmanager
pkgver=0.3.0
pkgrel=3
pkgdesc="A bridge between ntfy and Alertmanager"
url="https://hub.xenrox.net/~xenrox/ntfy-alertmanager"
arch="all"
license="AGPL3"
makedepends="go"
install="$pkgname.pre-install"
subpackages="$pkgname-openrc"
source="https://git.xenrox.net/~xenrox/ntfy-alertmanager/refs/download/v$pkgver/ntfy-alertmanager-$pkgver.tar.gz
	ntfy-alertmanager.initd
	"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	go build -o ntfy-alertmanager
}

check() {
	go test ./...
}

package() {
	install -Dm755 ntfy-alertmanager "$pkgdir"/usr/bin/ntfy-alertmanager
	install -Dm644 config.scfg "$pkgdir"/etc/ntfy-alertmanager/config
	install -Dm755 "$srcdir"/ntfy-alertmanager.initd "$pkgdir"/etc/init.d/ntfy-alertmanager
}

sha512sums="
8bde22778aae862a8fbde0c5fc8f966ee55b39cbc9f28b7983af356ea8ab8522030a4477df2bd47f3e6aea295a5c2f18a69657977b6760b78355eeb748646ddf  ntfy-alertmanager-0.3.0.tar.gz
843b3e00af5019d1af9330717598631cf76d8876bb373cc31419173897e01d889ffa3dab0c29ac91e15eec6677ca629b199d0dfc1ffe4e00c5ae895364cbfd7c  ntfy-alertmanager.initd
"
